package com.llp.declaresystem.mapper;

import com.llp.declaresystem.domain.dto.HighQueryProjectDto;
import com.llp.declaresystem.domain.entity.Project;
import com.llp.declaresystem.domain.entity.ProjectCategory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author NASK
* @description 针对表【project_category(项目类别表)】的数据库操作Mapper
* @createDate 2022-11-23 16:22:41
* @Entity com.llp.declaresystem.entity.ProjectCategory
*/
@Mapper
public interface ProjectCategoryMapper extends BaseMapper<ProjectCategory> {

    /**
     * 通过expertId查询项目信息
     * @param expertId
     * @return
     */
    @Select("select * from project_category where expertid = #{expertId};")
    List<ProjectCategory> searchAllByExpertId(Integer expertId);

    /**
     * 通过categoryId查询项目信息
     * @param categoryId
     * @return
     */
    @Select("select * from project_category where categoryid = #{categoryid};")
    List<ProjectCategory> selectAllByCategoryId(Integer categoryId);

    /**
     * 根据expertId查询
     * @param expertId
     * @return
     */
    @Select("select categoryid from project_category where expertid=#{expertId}")
    List<Integer> selectByExpertid(Integer expertId);

    /**
     * 根据categoryid获取项目分类信息
     * @param categoryid
     * @return
     */
    @Select("select * from project_category where categoryid=#{categoryid}")
    ProjectCategory selectByCategoryid(Integer categoryid);

    /**
     * 根据categoryname进行模糊查询
     * @param categoryname
     * @return
     */
    @Select("select categoryid from project_category where categoryname like #{categoryname}")
    List<Integer> selectByCategoryname(@Param("categoryname") String categoryname);

    /**
     * 根据条件进行模糊查询
     * @param highQueryProjectDto
     * @return
     */
    @Select("select categoryid from project_category where " +
            "categoryname like concat('%',#{categoryName},'%') " +
            "and rep_start_time <= #{repStartTime} " +
            "and rep_stop_time >=#{repStopTime} ")
    List<Integer> selectByCategorynameAndRepStartTimeAndRepStopTime(HighQueryProjectDto highQueryProjectDto);

}




